package com.szhuang.mobilesafe.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.szhuang.mobilesafe.R;

/**
 * Created by szhuang on 2015/3/22.
 */
public class LostFindActivity extends Activity{

    private SharedPreferences sp;
    TextView tv_phone;
    ImageView iv_lock;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_lost_find);
        init();

    }

    public void init(){
        iv_lock=(ImageView)findViewById(R.id.lock);
        tv_phone=(TextView)findViewById(R.id.phone);
        sp=getSharedPreferences("config",MODE_PRIVATE);
        boolean configed=sp.getBoolean("configed",false);
        if(!configed){
            Intent intent=new Intent(LostFindActivity.this,SetUpFirstPage.class);
            startActivity(intent);
            finish();
        }
        String phone=sp.getString("safephone","");
        tv_phone.setText(phone);
        Boolean isOpen=sp.getBoolean("openSafe",false);
        if(isOpen){
            iv_lock.setImageResource(R.drawable.lock);
        }
    }

    public void reSetup(View view){
        Intent intent=new Intent(LostFindActivity.this,SetUpFirstPage.class);
        startActivity(intent);
        finish();

    }
}
